package com.hfi.state.demo01;

/**
 * @author ChangLiang
 * @date 2020/4/14
 */
public class FireSwitch {

    private int state;

    public FireSwitch() {
        // closed state
        state = 0;
    }

    public void changeFireClockWise() {
        if (state == 0) {
            state = 1;
            System.out.println("small fire");
        } else if (state == 1) {
            state = 2;
            System.out.println("medium fire");
        } else if (state == 2) {
            state = 3;
            System.out.println("large fire");
        } else {
            state = 0;
            System.out.println("close fire");
        }
    }

    public void changeFireCounterClockWise() {
        if (state == 0) {
            state = 3;
            System.out.println("large fire");
        } else if (state == 3) {
            state = 2;
            System.out.println("medium fire");
        } else if (state == 2) {
            state = 1;
            System.out.println("small fire");
        } else {
            state = 0;
            System.out.println("close fire");
        }
    }
}
